from rest_framework import serializers
from apps.goods.models import GoodsVisitCount


# 序列化器
class CategorySerializer(serializers.ModelSerializer):

    # 这里使用str是为了让前段出现文字，不是商品ｉｄ
    category = serializers.StringRelatedField(read_only=True)

    class Meta:
        model = GoodsVisitCount

        fields = ['category', 'count']